package org.mozhu.file.manager.mount;

public class MountMeta {

	private String mountPath; // resource
	private String sourcePath; // Z:/XX/YY/resource

	public MountMeta(String mountPath, String sourcePath) {
		super();
		this.mountPath = mountPath;
		this.sourcePath = sourcePath;
	}

	public String getMountPath() {
		return mountPath;
	}

	public String getSourcePath() {
		return sourcePath;
	}

	public boolean isMatchMountPath(String virtualPath) {
		return virtualPath.startsWith("/" + mountPath);
	}

	public boolean isMatchSourcePath(String realPath) {
		return realPath.startsWith(sourcePath);
	}

	public String getRealPath(String virtualPath) {
		if (isMatchMountPath(virtualPath)) {
			return sourcePath + virtualPath.substring(("/" + mountPath).length());
		}
		return null;
	}
	
	

}
